/**
 * Created by vincent on 2017/9/28.
 */
moduleQuiz.controller('EditQuizTopicAttribute', function ($$CambioConfig, $scope, $log, LoadingService, DialogService, UploadFileService) {
    initPage($scope);
    $scope.$on("ngDialog.opened", function () {
        dialogOnLoad();
    });

    $scope.cancel = function () {
        DialogService.close();
    };

    /**
     * 上传图片
     * @param $files
     */
    $scope.uploadImage = function ($files) {
        if ($files && $files[0]) {
            UploadFileService.uploadFile($files[0], $$CambioConfig.UPLOAD_URL, 'IMG', $scope).then(function (o) {
                $scope.editingAttribute.picture = o.id;
            });
        }
    };

    $scope.submit = function () {
        if ($scope.editGAForm.$valid) {
            angular.copy($scope.editingAttribute, $scope.currentAttribute);
            DialogService.close();
        }
    };

});